package com.hugang.principle.singleresponsibility;

/**
 * 单一职责原则示例  交通工具示例
 *
 * 方案1：违反了单一职责原则
 *
 * @author hg
 * @date 2020/9/6 10:48
 */
public class SingleResponsibilityDemo1 {

    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        vehicle.run("摩托车");
        vehicle.run("汽车");
        //此处是不合理的，违反了单一职责原则
        vehicle.run("飞机");
    }
}

class Vehicle{
    public void run(String vehicle){
        System.out.println(vehicle + "在路上跑。");
    }
}
